package com.example.community.del;

import com.example.community.dao.PaymanagerDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/payManagerDeleteServlet")
public class PayManagerDeleteServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String pmNo = req.getParameter("pmNo");
        PaymanagerDao paymanagerDao = new PaymanagerDao();
        Integer delete = paymanagerDao.delete(Integer.parseInt(pmNo));
        if (delete == 1){
            // 删除成功
            resp.getWriter().write("true");
//                System.out.println("删除成功");
        }else {
            // 删除失败
            resp.getWriter().write("false");
//                System.out.println("删除失败");
        }
    }
}
